<?php

namespace app\uniapp\service;

use app\model\site\DiyPage;
use app\uniapp\service\traits\InstanceTrait;

class DiyService extends UniBaseService
{

    use InstanceTrait;

    function initialize()
    {
        $this->model = new DiyPage();
    }

    /** 商品分类页样式
     * @return array|string|null
     */
    public function getGoodsCatePage(): array|string|null
    {
        $content = DiyPage::where('site_id', $this->siteId)
            ->where('page_type', 'goods_cate')
            ->where('is_default', 1)
            ->limit(1)
            ->value('content');
        return miUnserialize($content);
    }

    function formatData(array $data): array
    {
        return $data;
    }
}
